package com.ssm.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssm.dao.KcSizeMapper;
import com.ssm.dao.KucunMapper;
import com.ssm.model.Kucun;
import com.ssm.service.KucunService;
import com.ssm.util.DataSourceInterceptor;
import com.ssm.util.DatabaseContextHolder;

@Service("kucunService")
public class KucunServiceImpl implements KucunService {

	@Autowired
	KucunMapper kucunMapper;
	@Autowired
	KcSizeMapper kcSizeMapper;
	@Override
	public List<Kucun> getKcBytz(Integer tz) {
		// TODO Auto-generated method stub
		DatabaseContextHolder.setCustomerType(DataSourceInterceptor.dataSource1);
		return kucunMapper.allListBytz(tz);
	}

	@Override
	public List<Kucun> getallKzs() {
		// TODO Auto-generated method stub
		DatabaseContextHolder.setCustomerType(DataSourceInterceptor.dataSource1);
		return kucunMapper.selectAll();
	}

	@Override
	public Integer kcSize1(Map<String, Object> map) {
		// TODO Auto-generated method stub
		DatabaseContextHolder.setCustomerType(DataSourceInterceptor.dataSource2);
		return kcSizeMapper.kcSize1(map);
	}

	@Override
	public Integer kcSize2(Map<String, Object> map) {
		// TODO Auto-generated method stub
		DatabaseContextHolder.setCustomerType(DataSourceInterceptor.dataSource2);
		return kcSizeMapper.kcSize2(map);
	}

	@Override
	public Integer updateKucun(Kucun kucun) {
		// TODO Auto-generated method stub
		DatabaseContextHolder.setCustomerType(DataSourceInterceptor.dataSource1);
		return kucunMapper.updateKucun(kucun);
	}

}
